package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.service.ISendVerifyCodeService;
import cn.wolfcode.trip.base.util.HttpUtil;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

@Service
public class SendVerifyCodeServiceImpl implements ISendVerifyCodeService {

    public void send(String phoneNumber,String content) {
        Date now = new Date();
        //2.执行发送
        String code = UUID.randomUUID().toString().substring(0,4);
        sendSms(phoneNumber,content);
    }

    public void sendSms(String phone,String content){

        Map<String,String> map = new HashMap<>();
        //?phone=13547119500&code=12345678&skin=1&appkey=您申请的APPKEY
        map.put("Uid","longer1");
        map.put("Key","d41d8cd98f00b204e980long");
        map.put("smsMob",phone);
        map.put("smsText",content+"【骡窝窝官方】");

        try {
            String result = HttpUtil.sendHttpRequest("http://utf8.api.smschinese.cn/",map);
            System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
